;(function($,window,document,undefined){var _doc=$(document),$body=$("body");methods={init:function(options){return this.each(function(){var $this=$(this),opt=$this.data("hDialog");if(typeof(opt)=="undefined"){var defaults={title:"",box:"#HBox",boxBg:"#fff",modalBg:"rgba(0,0,0,0.5)",closeBg:"#ccc",width:300,height:270,positions:"center",triggerEvent:"click",effect:"hide",resetForm:true,modalHide:true,closeHide:true,escHide:true,beforeShow:function(){},afterHide:function(){}};opt=$.extend({},defaults,options);$this.data("hDialog",opt)}opt=$.extend({},opt,options);$(opt.box).hide();$this.on(opt.triggerEvent,function(){if(opt.resetForm){var $obj=$(opt.box);$obj.find("input[type=text],textarea").val("");$obj.find("select option").removeAttr("selected");$obj.find("input[type=radio],input[type=checkbox]").removeAttr("checked")}if(opt.escHide){$(document).keyup(function(event){switch(event.keyCode){case 27:methods.close(opt);break}})}methods.fire.call(this,opt.beforeShow);methods.add(opt,$this);var $close=$("#HCloseBtn");if(opt.modalHide){$close=$("#HOverlay,#HCloseBtn")}$close.on("click",function(event){event=event||window.event;event.stopPropagation();methods.close(opt)})})})},add:function(o,$this){var w,h,t,l,m;$obj=$(o.box);title=o.title;c=$this.attr("class");modalBg=o.modalBg;closeBg=o.closeBg;w=o.width!=undefined?parseInt(o.width):"300";h=o.height!=undefined?parseInt(o.height):"270";m=""+(-(h/2))+"px 0 0 "+(-(w/2))+"px";switch(o.positions){case"center":t=l="50%";break;case"top":t=0;l="50%";m="0 0 0 "+(-(w/2))+"px";break;case"left":t=l=m=0;break;default:t=l="50%"}methods.remove("#HOverlay,#HCloseBtn,#HTitle");$body.stop().append("
");if(o.title!=""){$obj.stop().prepend('